import axios from '@/api/http'

// const OFFICIAL_ADDRESS = 'http://10.5.24.17:8092/'
const OFFICIAL_ADDRESS = ''

export const queryEnablePlugin = (options?: any) =>
  axios.request({
    ...options,
    url: '/plugin/queryEnablePlugin',
  })

export const queryAllPlugin = (options?: any) =>
  axios.request({
    ...options,
    url: 'plugin/queryAllPlugin',
  })

export const install = (options?: any) =>
  axios.request({
    ...options,
    url: 'plugin/install',
  })

export const uninstall = (options?: any) =>
  axios.request({
    ...options,
    url: 'plugin/uninstall',
  })

export const queryStatus = (options?: any) =>
  axios.request({
    ...options,
    url: 'plugin/queryStatus',
  })

export const loadLocalPanel = (options?: any) =>
  axios.request({
    ...options,
    url: 'modelLocal/loadPanel',
  })

export const loadOnlinePanel = (options?: any) =>
  axios.request({
    ...options,
    url: 'modelOnline/loadPanel',
  })

export const queryOnlineModel = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelOnline/query`,
  })

export const queryCase = (options?: any) =>
  axios.request({
    ...options,
    url: 'modelOnline/queryCase',
  })

export const queryLocalModel = (options?: any) =>
  axios.request({
    ...options,
    url: 'modelLocal/query',
  })

export const queryOnlineModelById = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelOnline/queryById`,
  })

export const queryLocalModelById = (options?: any) =>
  axios.request({
    ...options,
    url: 'modelLocal/queryById',
  })

export const updateModel = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelOnline/update`,
  })

export const deleteLocalModel = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelLocal/delete`,
  })

export const deleteOnlineModel = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelOnline/delete`,
  })

export const createModel = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelOnline/create`,
  })

export const favorModel = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelOnline/favor`,
  })

export const viewModel = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelOnline/watch`,
  })

export const statisticsModel = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelOnline/statistics`,
  })

export const installModel = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelOnline/install`,
  })

// 查看历史版本
export const queryVersion = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelLocal/queryVersion`,
  })

// 查看历史版本
export const queryByUid = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelLocal/queryByUid`,
  })

// 加载模型
export const importModel = (options?: any) =>
  axios.request({
    ...options,
    url: `${OFFICIAL_ADDRESS}modelLocal/loadModel`,
  })

// 查询已加载的项目
export const queryProjectUsed = (options?: any) =>
  axios.request({
    ...options,
    url: 'modelLocal/queryProjectIds',
  })

// 从项目中移除已加载的模型
export const deleteFromProject = (options?: any) =>
  axios.request({
    ...options,
    url: 'modelLocal/deleteFromProject',
  })

// 社区首页加载算法&模型
export const newCaseAndMost = (options?: any) =>
  axios.request({
    ...options,
    url: 'modelOnline/newCaseAndMost',
  })

// 点击播放视频
export const addVideoView = (options?: any) =>
  axios.request({
    ...options,
    url: 'modelOnline/addVideo',
  })

// 试用案例，检测安装条件
export const queryTryOptions = (options?: any) =>
  axios.request({
    ...options,
    url: '/case/checkModel',
  })

// 案例试用
export const caseInstall = (options?: any) =>
  axios.request({
    ...options,
    url: '/case/install',
  })
